package com.suxin.websocket.handler;

import com.suxin.websocket.model.BaseModel;
import com.suxin.websocket.model.ModelEnum;
import com.suxin.websocket.model.RelationRequestModel;
import com.suxin.websocket.pusher.FriendRelationPusher;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author Tang
 * @classname FriendRelationHandler
 * @description [  ]
 * @date 2022/3/24 15:16
 */
@Component
public class FriendRelationHandler implements Handler<BaseModel> {

//    @Resource
//    InvitationService invitationService;

    @Resource
    FriendRelationPusher friendRelationPusher;

    @Override
    public void handler(BaseModel baseModel) {
        if (baseModel instanceof RelationRequestModel) {
            RelationRequestModel request = (RelationRequestModel) baseModel;
//            InvitationRecord record = new InvitationRecord();
//            BeanUtils.copyProperties(request, record);
//            invitationService.updateInvitationRelation(record);
        }
    }

    @Override
    public boolean isSupport(BaseModel data) {
        return data.getType() == ModelEnum.FRIENDNOTIFY.getCode();
    }
}